home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 201-225 / disk_217 / stevie / inc.c < prev    next >
C/C++ Source or Header  |  1992-05-06  |  800b  |  34 lines

  1. /*
  2.  * STEVIE - Simply Try this Editor for VI Enthusiasts
  3.  *
  4.  * Code Contributions By : Tim Thompson           twitch!tjt
  5.  *                         Tony Andrews           onecom!wldrdg!tony 
  6.  *                         G. R. (Fred) Walter    watmath!watcgl!grwalter 
  7.  */
  8.  
  9. #include "stevie.h"
  10.  
  11. /*
  12.  * inc(p) 
  13.  *
  14.  * Increment the line pointer 'p' crossing line boundaries as necessary. Return
  15.  * 1 when crossing a line, -1 when at end of file, 0 otherwise. 
  16.  */
  17. int
  18. inc(lp)
  19.     register LPtr  *lp;
  20. {
  21.     register char  *p = &(lp->linep->s[lp->index]);
  22.  
  23.     if (*p != NUL) {        /* still within line */
  24.     lp->index++;
  25.     return ((p[1] != NUL) ? 0 : 1);
  26.     }
  27.     if (lp->linep->next != Fileend->linep) {    /* there is a next line */
  28.     lp->index = 0;
  29.     lp->linep = lp->linep->next;
  30.     return 1;
  31.     }
  32.     return -1;
  33. }
  34.